package cc.market.mapper;

import cc.market.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {

    @Insert("insert into user ( id,phone, password,status,nick_name,update_time,create_time) values (#{id},#{phone},#{password}," +
            "#{status},#{nickName},#{updateTime},#{createTime})")
    int addUser(User user);

    @Select("select * from user where phone = #{phone}")
    User getByPhone(String phone);

    @Select("select * from user where id = #{userId}")
    User getById(Integer userId);

    void update(User user);

    @Update("update user set password = #{encryptedPassword} where id = #{id}")
    void updatePwd(Integer id,String encryptedPassword);
}
